﻿namespace DesignModeConsole.行为型.中介者模式.基础;

/// <summary>
/// 具体中介者
/// </summary>
public class ConcreteMediator : Mediator1
{
    private Colleague A { get; set; }
    private Colleague B { get; set; }

    public void Send(string message, Colleague colleague)
    {
        if (colleague.GetType() == typeof(ColleagueA))
        {
            B.ReceiveMessage(message);
        }
        else
        {
            A.ReceiveMessage(message);
        }
    }

    /// <summary>
    /// 设置同事类
    /// </summary>
    /// <param name="colleague"></param>
    /// <param name="colleague1"></param>
    public void SetColleague(Colleague colleague, Colleague colleague1)
    {
        A = colleague;
        B = colleague1;
    }
}